// 资源引入
//引入的 request 方法和 $.ajax 是一样的用法,唯一区别就是 jquery 定义请求方法类型的 type 变成了 method 
import request from '@/utils/request';
import API from '@/api/contract/team';
import axios from 'axios';

// 接口10: 已签订班组合同
export function querySubcontractorCountList(query) {
    console.log('【接口10: 已签订班组合同】');
    let timestamp = new Date().getTime();
    return request({
        url: API.querySubcontractorCountList + '?timestamp=' + timestamp,
        method: 'post',
        data: query
    })
}

// 接口8：待签订合同项目列表
export function prjectContract(query) {
    console.log('【接口8：项目合同列表】');
    let timestamp = new Date().getTime();
    return request({
        url: API.prjectContract + '?timestamp=' + timestamp,
        method: 'post',
        data: query
    })
}

// 接口9：待签订班组合同
export function teamContract(query) {
    console.log('【接口9：班组合同】');
    let timestamp = new Date().getTime();
    return request({
        url: API.teamContract + '?timestamp=' + timestamp,
        method: 'post',
        data: query
    })
}

// 接口11：合同列表
export function contractList(query) {
    console.log('【接口9：班组合同】');
    let timestamp = new Date().getTime();
    return request({
        url: API.contractList + '?timestamp=' + timestamp,
        method: 'post',
        data: query
    })
}

// 接口5：查询合同详情
export function contractDetail(query) {
    console.log('【接口5：查询合同详情】');
    let timestamp = new Date().getTime();
    return request({
        url: API.contractDetail + '?timestamp=' + timestamp,
        method: 'post',
        data: query
    })
}

// 接口15：查询合同附件
export function contractEnclosureFile(query) {
    console.log('【接口5：查询合同详情】');
    let timestamp = new Date().getTime();
    return request({
        url: API.contractEnclosureFile + '?timestamp=' + timestamp,
        method: 'post',
        data: query
    })
}

// 查询企业和项目经理关系列表
export function queryEnterpriseMountList(query) {
    console.log('【查询企业和项目经理关系列表】');
    let timestamp = new Date().getTime();
    return request({
        url: API.queryEnterpriseMountList + '?timestamp=' + timestamp,
        method: 'post',
        data: query
    })
}

// 拒绝和删除项目经理的绑定
export function refuseOrDelete(query) {
    console.log('【拒绝和删除项目经理的绑定】');
    let timestamp = new Date().getTime();
    return request({
        url: API.refuseOrDelete + '?timestamp=' + timestamp,
        method: 'post',
        data: query
    })
}

// 审批通过项目经理绑定请求
export function throughApproval(query) {
    console.log('【审批通过项目经理绑定请求】');
    let timestamp = new Date().getTime();
    return request({
        url: API.throughApproval + '?timestamp=' + timestamp,
        method: 'post',
        data: query
    })
}

// 接口7：取消合同
export function cancelContract(query) {
    console.log('【接口7：取消合同】');
    let timestamp = new Date().getTime();
    return request({
        url: API.cancelContract + '?timestamp=' + timestamp,
        method: 'post',
        data: query
    })
}

// 获取验证码
export function getYzm(query) {
    console.log('【获取验证码】');
    let timestamp = new Date().getTime();
    return axios({
        url: `${API.getYzm}?oemType=${query.eomType}&phone=${query.phone}`,
        method: 'get'
    })
}

// 手机验证码验证
export function valideYzm(data) {
  return axios({
    url: `${API.valideYzm}?phone=${data.phone}&code=${data.code}`,
    method: 'post'
  })
 } 

// 接口6：签署合同
export function signContract(query) {
    console.log('【接口6：签署合同】');
    let timestamp = new Date().getTime();
    return request({
        url: API.signContract + '?timestamp=' + timestamp,
        method: 'post',
        data: query
    })
}

// 接口1: 查询项目
export function queryProjectInfoByAccount(query) {
    console.log('【接口1: 查询项目】');
    let timestamp = new Date().getTime();
    return request({
        url: API.queryProjectInfoByAccount + '?timestamp=' + timestamp,
        method: 'post',
        data: query
    })
}


// 接口2：公司查询
export function queryCompanyList(query) {
    console.log('【接口2：公司查询】');
    let timestamp = new Date().getTime();
    return request({
        url: API.queryCompanyList + '?timestamp=' + timestamp,
        method: 'post',
        data: query
    })
}


// 接口3：查询班组长
export function querySubcontractorList(query) {
    console.log('【接口3：查询班组长】');
    let timestamp = new Date().getTime();
    return request({
        url: API.querySubcontractorList + '?timestamp=' + timestamp,
        method: 'post',
        data: query
    })
}

// 文件上传接口
export function uploadContractFile(query) {
    console.log('【文件上传接口】');
    let timestamp = new Date().getTime();
    return request({
        url: API.uploadContractFile + '?timestamp=' + timestamp,
        method: 'post',
        data: query
    })
}


// 添加合同
export function addContract(query) {
    console.log('【添加合同】');
    let timestamp = new Date().getTime();
    return request({
        url: API.addContract + '?timestamp=' + timestamp,
        method: 'post',
        data: query
    })
}


// 接口12：合同数量
export function queryContractProjectNum(query) {
    console.log('【接口12：合同数量】');
    let timestamp = new Date().getTime();
    return request({
        url: API.queryContractProjectNum + '?timestamp=' + timestamp,
        method: 'post',
        data: query
    })
}